import json
import traceback
from flask import request
from framework import app
from framework.util.RespUtil import RespUtil

#view里用request.args.get("pollutant_id")获取get json参数里的值
@app.before_request
def before_request_handler():
    try:
        if request.method == 'GET':
            json_args = request.args.get('json')
            if json_args is not None:
                dict_data = json.loads(json_args)
                request.args=dict_data
    except Exception as e:
        traceback.print_exc()
        return RespUtil.inner_error().build()
